'use strict'
var gulp = require('gulp'),
     uglify = require('gulp-uglify'),
     pump = require('pump'),
     cssmin = require('gulp-cssmin'),
    clean = require('gulp-clean');
var STATIC_SRC = 'static/';
var paths = {
    allCss: [STATIC_SRC + 'css/*.css', STATIC_SRC + 'css/*/*.css'],
    scripts: [STATIC_SRC + 'js/*.js',STATIC_SRC + 'js/*/*.js']
};

 
gulp.task('clean', function () {
    return gulp.src('dist-static/', {read: false})
        .pipe(clean());
});

gulp.task('copy', ['clean'], function() {
    return gulp.src('static/**/*')
        .pipe(gulp.dest('dist-static'));
});

gulp.task('uglify', function (cb) {
  pump([
        gulp.src(paths.scripts),
        uglify(),
        gulp.dest('dist-static/js')
    ],
    cb
  );
});

gulp.task('css', function () {
    gulp.src(paths.allCss)
        .pipe(cssmin())
        .pipe(gulp.dest('dist-static/css'));
});

// gulp.task('default',function(){
//     gulp.run('copy-file','css','uglify');
// }); 
gulp.task('default',['copy'],function(){
    gulp.start('css','uglify');
}); 